package domain;

import basic.CRUDable;

//@author A0098891H
public class PaymentMethod extends CRUDable{
	
	private String _name;
	/**
	 * 
	 */
	public PaymentMethod()
	{
		_name = "";
	}	
	/**
	 * @param pay
	 */
	public PaymentMethod(PaymentMethod pay)
	{
		set(pay);
	}
	/**
	 * @param name
	 */
	public PaymentMethod(String name)
	{
		_name = name;
	}

	/**
	 * 
	 * @param pay
	 * @Precondition 
	 * @Postcondition 
	 */
	public void set(PaymentMethod pay)
	{
		_name = pay._name;
	}
	
	/**
	 * 
	 * @return
	 * @Precondition 
	 * @Postcondition 
	 */
	public String get_name() {
		return _name;
	}

	/**
	 * 
	 * @param name
	 * @Precondition 
	 * @Postcondition 
	 */
	public void set_name(String name) {
		_name = name;
	}
	
	/**
	 *
	 * @see java.lang.Object#toString()
	 * @return
	 * @Precondition 
	 * @Postcondition 
	 */
	public String toString()
	{
		return _name.toUpperCase();
	}
	
	/**
	 * 
	 * @param method
	 * @return
	 * @Precondition 
	 * @Postcondition 
	 */
	public boolean equals(PaymentMethod method)
	{
		if(method._name.equalsIgnoreCase(_name))
		{
			return true;
		}
		return false;
	}
	
	/**
	 * 
	 * @return
	 * @Precondition 
	 * @Postcondition 
	 */
	public String writeToString()
	{
		String str = this._name + "," + this._id;
		return str;
	}
}
